#pragma once
#include "fxcc/core/graph/common/EffectBase.h"
#include "fxcc/core/graph/common/Transform.h"
#include "fxcc/core/graph/common/Camera.h"
#include "fxcc/core/graph/common/OrthoCamera.h"
#include "fxcc/core/graph/common/Viewport.h"
#include "fxcc/core/graph/common/ProjSub.h"
#include "fxcc/core/graph/common/Type.h"

namespace fxcc
{
	namespace graph
	{
		namespace common
		{
			struct FXCC_API Effect3d :public EffectBase
			{
				struct  BoneData {

					glm::mat4 bones[256];
				};
				struct  PassData
				{
					glm::mat4 m_Proj;
					glm::mat4 m_View;
					glm::mat4 m_ProjView;
					glm::mat4 m_SkyboxView;
					glm::vec3 m_ViewPos;
					float m_NearZ;
					glm::vec2 m_Pad2 ;
					int m_Pad3;
					float m_FarZ;

					PassData():
						m_Proj(glm::mat4(1.0f)),
						m_View(glm::mat4(1.0f)),
						m_ProjView(glm::mat4(1.0f)),
						m_ViewPos(glm::vec3(0.0f)),
						m_NearZ(0.f),
						m_Pad2(glm::vec2(0.0f)),
						m_Pad3(0),
						m_FarZ(10000.f)
					{
					};

					void SetProj(const fxcc::graph::common::ProjSub&);

					void SetProj(const glm::mat4&);

					void SetViewFromTransfrom(const fxcc::graph::common::Transform& transform);

					void SetProj(const fxcc::graph::common::Frustum& frustum);

					void SetProj(const fxcc::graph::common::Viewport& viewport);

					void Load(const fxcc::graph::common::Camera& camera);
				
					void Load2(const fxcc::graph::common::OrthoCamera& camera);

					void Transpose();

				};




				struct ObjData
				{
					glm::mat4 world;
					glm::mat4 worldInv;
					glm::mat4 worldInvTranspose;
					int objPad0;
					float borderNormalAxis;
					int objId;
					int objBufferPad;

					ObjData() :
						world(glm::mat4(1.0f)),
						worldInv(glm::mat4(1.0)),
						worldInvTranspose(glm::mat4(1.0f)),
						objPad0(0),
						borderNormalAxis(0.f),
						objId(0),
						objBufferPad(0)
					{

					}
					void Load(const fxcc::graph::common::Transform& transform);

					void Transpose();
				};


			};
		}
	}
}